package org.example.service.impl;

import lombok.extern.log4j.Log4j2;
import org.example.entity.IesCust;
import org.example.mapper.IesCustMapper;
import org.example.utils.SnowFlake;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * ============================================================<br>
 * <p> ProjectName ：mybatis_plus </p>
 * <p> @author dongjianzhao </p>
 * <p> @date 2023/3/3 </p>
 * <p> @version ：1.0 </p>
 * ============================================================<br>
 * <p>
 *
 * </p>
 * ============================================================<br>
 */
@Service
@Log4j2
public class CeshiHeTongImpl {
    @Autowired
    private IesCustMapper iesCustMapper;

    List<IesCust> list_iesCust=new ArrayList<>();

    private List<IesCust> iesCustbatchInserts2(  SnowFlake snowFlake) {
        List<IesCust> listiescut=new ArrayList<>();
        Map<String,String> mapiescut=new HashMap<>();
        list_iesCust.forEach(f->{
           /* String custname = f.getCustname();
            String s ="".equals(f.getCustno())==true?null: mapiescut.get(f.getCustno());
            // String s1 = mapiescutname.get(f.getQiyemingcheng());
            if(s==null){
                Map<String,Object> map2=new HashMap<>();
                map2.put("custname",custname);
                List<IesCust> list = iesCustMapper.selectByMap(map2);
                if(list.size()==0){
                    IesCust ic=new IesCust();
                    ic.setCustid(snowFlake.nextId()+"");
                    ic.setCustno(f.getCustno());
                    ic.setCustname(custname);
                    ic.setOrgname("");
                    ic.setServerenddate("2023-03-06");
                    ic.setServerstartdate("2023-03-06");
                    ic.setStatus(f.getStatus());
                    ic.setCustsettype("01");
                    listiescut.add(ic);
                    mapiescut.put(f.getCustno(),f.getCustno());
                }
            }*/
        });
        iesCustMapper.batchInserts(listiescut);
        return listiescut;
    }
}
